/**
 * @Author 韦建韩
 * @Date 2022/5/15
 */
package com.example.devops.Manage;

import com.example.devops.Manage.UserManager.UserInfoManage;
import com.example.devops.entity.pojo.User;
import lombok.Data;

import java.util.LinkedList;
import java.util.concurrent.ConcurrentHashMap;

public class RecentlyPublishCache {
    public static ConcurrentHashMap<Long, LinkedList<Entity>> m = new ConcurrentHashMap<Long, LinkedList<Entity>>();
    public static LinkedList<Entity> get(){
        User user = UserInfoManage.get();
        m.putIfAbsent(user.getId(), new LinkedList<>());
       return m.get(user.getId());
    }
    public static void set(LinkedList<Entity> list){
        User user = UserInfoManage.get();
        m.put(user.getId(), list);
    }

    @Data
   public static class Entity{
        private long id;
        private String name;
        private Long userId;
    }
}